package com.lyz.service;

import com.lyz.mapper.StockMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StockService {

    @Autowired
    private StockMapper mapper;

    //根据商品id更新库存
    public Boolean updateStockByProductId(String productId,Integer count){

        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        return mapper.updateCountByProductId(productId, count)==1;
    }
}
